from machine import Pin, SPI
from ssd1306 import SSD1306_SPI
from time import sleep_ms

spi = SPI(0, 100000, mosi=Pin(19), sck=Pin(18))

#oled = SSD1306_SPI(WIDTH, HEIGHT, spi, dc,rst, cs) use GPIO PIN NUMBERS
oled = SSD1306_SPI(128, 64, spi, dc=Pin(17), res=Pin(16), cs=Pin(22))

while True:
    try:
        for i in range(40):
            for j in range(56):
                # clear the screen.
                oled.fill(0)
                oled.show()

                # draw the screen.
                oled.text("HELLO WORLD",i,j)
                oled.show()
                sleep_ms(10)
    except KeyboardInterrupt:
        break
